package com.example.pc.http;


import com.example.pc.updata.obj.Ts;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by acer on 2019/5/15.
 */

public class JS_Utils {
    /*
 * author:wsx
 */
    public static List<Ts.DataBean> getSubStringByRadom(List<Ts.DataBean> list, int count) {
        List backList = null;
        backList = new ArrayList<Ts.DataBean>();
        Random random = new Random();
        int backSum = 0;
        if (list.size() >= count) {
            backSum = count;
        } else {
            backSum = list.size();
        }
        for (int i = 0; i < backSum; i++) {
//			随机数的范围为0-list.size()-1
            int target = random.nextInt(list.size());
            backList.add(list.get(target));
            list.remove(target);
        }
        return backList;
    }

}
